<!-- pass a variable to included page -->
<%@ page import="SSP.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<% 
   String today = null;
   Today t = new Today();
   today = t.getToday();
   request.setAttribute("picture","InstructorSamples");
   request.setAttribute("title", "Product List (for internal use only)");  
   request.setAttribute("header", "Welcome : Today is " + today); 
 %>
 <%@ include file="header.jsp"%>
<TD width="850" vAlign="top"> 

<br /><h2>Product List</h2><br />
<table width=100% border=0>

<%
String myQuery = "SELECT m.modalityid, m.modalitydescription, p.productname, c.customername," +
" l.city, l.state, e.inservicedate, sc.servicecontractdescription" +
" from modality m, customer c, location l, servicecontract sc, status s, product p, equipment e" +
" where c.servicecontractid = sc.servicecontractid and c.customerid = l.customerid" +
" and l.locationid = e.locationid and e.statusid = s.statusid and e.productid = p.productid and p.modalityid = m.modalityid" +
" order by m.modalitydescription asc, p.productname asc, c.customername asc ";

System.out.println(myQuery);

OraDB myDB = new OraDB();
ResultSet rs = null;
myDB.createConnection();
rs=myDB.Query(myQuery); 
String mymodality="";

String myQuery1 = "Select * from modality order by modalitydescription asc";

System.out.println(myQuery1);

OraDB myDB1 = new OraDB();
ResultSet rs1 = null;
myDB1.createConnection();
rs1=myDB1.Query(myQuery1); 
String mylist="";
%>
	 
<b><h3>Modality : </h3></b>
	 

<% while (rs1.next()) {%>
	< 
	<A Href=#<%=rs1.getInt("modalityid")%>><%=rs1.getString("modalitydescription")%></A>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% } %>


	 
<%  while (rs.next()) {   
	if (mymodality.equals(rs.getString("modalitydescription"))) {
	} else { 
		mymodality = rs.getString("modalitydescription");%>
		<tr> <td colspan="7"><hr /> </td></tr>
		<tr>
		<th style="color: blue;"><%=mymodality%><a name=<%=rs.getInt("modalityid")%>></a></th>
		<td><a href="#top" style="color: blue;">Back to the Top</a></td></tr>
		
		<tr>
		<th bgcolor="#3B73B9" style="color:white;">Product</th>
		<th bgcolor="#3B73B9" style="color:white;">Customer</th>
		<th bgcolor="#3B73B9" style="color:white;">Location</th>
		<th bgcolor="#3B73B9" style="color:white;">In Service Date</th>
		<th bgcolor="#3B73B9" style="color:white;">Service Contract</th>
		</tr>
<%	} %>

        <tr>
		<td><%=rs.getString("productname")%></td>
		<td><%=rs.getString("customername")%></td>
		<td><%=rs.getString("city") + ", " + rs.getString("state")%></td>
		<td><%=rs.getString("inservicedate").substring(0,10)%></td>
		<td><%=rs.getString("servicecontractdescription")%></td>		
		</tr>
 <%  } %>
</table>
<%
rs.close();
myDB.closeConnection(); 
rs1.close();
myDB1.closeConnection(); 
%>
</TD></TR></TABLE></body></html>